home *** CD-ROM | disk | FTP | other *** search
- /*
- * MultiMAIL offline mail reader
- *
-
- Written by Kolossvary Tamas (thomas@vma.bme.hu)
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
- #include <unistd.h>
- #include "interface.h"
-
- extern mmail mm;
- extern packet_list *packetList;
- extern HelpWindow helpwindow;
- extern AreaListWindow areas;
-
- PacketListWindow::PacketListWindow(void)
- {
- packetList = mm.getPacketList();
- }
-
- void PacketListWindow::MakeActive(void)
- {
- init_pair(40, COLOR_YELLOW, COLOR_BLUE);
- init_pair(42, COLOR_GREEN, COLOR_BLUE);
- list = newwin(LINES-17, 60, 11, 10);
- list_max_y = LINES-19;
- wattrset(list, COLOR_PAIR(40) | A_BOLD);
- for(int i=0; i < ((LINES-17)*60); i++)
- waddch(list, ' ');
- wborder(list, 0, 0, 0, 0, 0, 0, 0, 0);
- wattrset(list, COLOR_PAIR(42) | A_BOLD);
- mvwaddstr(list, 1, 1, " Packet Date");
- wnoutrefresh(list);
-
- Draw();
- helpwindow.packetlist();
- #ifdef SOUND_EFFECTS
- system("zcat /var/lib/mmail/select.packet.au.gz >/dev/audio &");
- #endif
- }
-
- int PacketListWindow :: NumOfItems(void)
- {
- return packetList->getNoOfPackets();
- }
-
- void PacketListWindow::Delete(void)
- {
- delwin(list);
- helpwindow.Delete();
- touchwin(screen);
- wnoutrefresh(screen);
- }
-
- void PacketListWindow::Draw(void)
- {
- int i, j;
- char tmp1[13];
- char tmp2[13];
-
- init_pair(41, COLOR_CYAN, COLOR_BLUE);
- if(NumOfItems())
- {
- for(i=1; i<list_max_y; i++)
- {
- packetList->gotoPacket(position+i);
-
- strcpy(tmp1, " ");
- strcpy(tmp2, packetList->getName());
- j=0;
- while((tmp2[j] != '.') && (j < 8))
- tmp1[j] = tmp2[j++];
- strncpy(&tmp1[8], &tmp2[j], 4);
-
- wattrset(list, COLOR_PAIR(41) | A_BOLD);
- if(position+i-1 == active) wattron(list, A_REVERSE);
- mvwprintw(list, i+1, 1, " %s", tmp1);
- // mvwprintw(list, i+1, 15, " %5d", packetList->getNoOfLetters());
- // mvwprintw(list, i+1, 27, " %5d", packetList->getNoOfPersonal());
- // mvwprintw(list, i+1, 41, " %5d ", packetList->getNoOfUnread());
- mvwprintw(list, i+1, 15, " %s ", packetList->getDate());
- if((position+i) == NumOfItems()) i=list_max_y;
- }
- packetList->gotoPacket(active+1);
- }
- else
- {
- wattrset(list, COLOR_PAIR(41) | A_BOLD);
- mvwaddstr(list, 3, 12, "It seems we don't have packets.");
- wrefresh(list);
- sleep(2);
- ungetch('Y');
- ungetch('Q');
- }
- wnoutrefresh(list);
- }
-